<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input placeholder="登陆编码" style="width: 200px;" class="filter-item" />
      <el-button class="filter-item" type="success" icon="el-icon-search">
        搜索
      </el-button>
      <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-plus">
        添加
      </el-button>
    </div>
    <el-table
      :data="menuTree"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      border
      default-expand-all
    >
      <el-table-column
        prop="name"
        label="资源名称"
      />
      <el-table-column
        prop="ordering"
        label="排序"
      />
      <el-table-column
        prop="url"
        label="链接地址"
      />
      <el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
        <template>
          <el-button type="primary" size="mini">
            编辑
          </el-button>
          <el-button size="mini" type="danger">
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { getMenuTree } from '@/api/user'
export default {
  name: 'MenuList',
  data() {
    return {
      menuTree: null
    }
  },
  created() {
    this.getTree()
  },
  methods: {
    // 获取菜单资源
    getTree() {
      getMenuTree().then(res => {
        console.log(res.data.content)
        this.menuTree = res.data.content
      })
    },
    handleNodeClick() {

    }
  }
}
</script>

<style lang="sass" scoped>

</style>
